function res = GetMagnetometerBandwidth(obj, varargin)
    import MeasurementComponent.Signal.*
    
    p=inputParser;
    p.addParameter('nPoint', 50, @(x) x>0);
    p.addParameter('average', 100, @(x) x>0);
    p.addParameter('signal_amplitude', 0.01, @(x) x>0 && x < 0.1);
    p.addParameter('start_frequency', 10.0, @(x) x>0);
    p.addParameter('finish_frequency', 300.0, @(x) x>0);
    p.addParameter('order', 4, @(x) ismember(x, 1:8));
    p.addParameter('bandwidth', 10.19, @(x) x>0);
    p.addParameter('liaIdx', 3, @(x) ismember(x, 1:4));
    p.addParameter('f129', 250.0, @(x) isnumeric(x) && x>0);
    p.addParameter('f131', 75.0, @(x) isnumeric(x) && x>0);
    p.addParameter('fRange', 40, @(x) isnumeric(x) && x>0);
    p.addParameter('isReport', false, @islogical);
    p.addParameter('isPlot', true, @islogical);
    p.addParameter('description', 'normal', @ischar);
    p.parse(varargin{:});

    %%
    if isempty(obj.SystemInfo.WorkingPoint)
        error('WorkingPoint cannot be obtained.');
    end
        
    %%
    obj.UnlockTransverseField('x'); pause(0.5);
    obj.bx.setDriver( obj.ziSlave.LockInChannel(1).setOscillator(p.Results.liaIdx) );
    obj.bx.setAC('frequency', 10, 'amplitude', p.Results.signal_amplitude, 'offset', obj.SystemInfo.WorkingPoint.biasX);
    liaChannel = obj.ziSlave.LockInChannel(p.Results.liaIdx).setup('order', p.Results.order, 'bandwidth', p.Results.bandwidth, 'phase', 0.0,  'isSinc', true);
    bxSig = Signal('bxAmplitude', liaChannel, 'reference', obj.bx);
    pause(5);
        
    %%
    bxSig.subscribe_signal(ziDemodTime.R_avg, [2, 1, 1]);
    bxSig.subscribe_signal(ziDemodTime.Theta_avg, [2, 1, 2]);
    swprData = bxSig.getParameterDependence(obj.ziSlave, ziSweepNode.Osc3Frequency, p.Results.start_frequency, p.Results.finish_frequency, ...
                                          'npoint', p.Results.nPoint, 'averaging_sample', p.Results.average,'isLog', false, 'sincfilter', 1);
    fitting = obj.FitMagnetometerBandwidth(swprData, varargin{:});
    
    %%
    obj.bx.disable();
    liaChannel.setup('isSinc', false);
    obj.LockTransverseField('x');
    
    %%
    res.timestamp=datetime('now');
    res.signal = swprData;
    res.fitting = fitting;
    res.parameter.polarization = 'x';
    res.parameter.amplitude = p.Results.signal_amplitude;
    res.parameter.start_frequency = p.Results.start_frequency;
    res.parameter.finish_frequency = p.Results.finish_frequency;
    res.parameter.filter_order = p.Results.order;
    res.parameter.filter_bandwidth = p.Results.bandwidth;
    res.parameter.filter_sinc = 'on';
    res.gain129 = fitting.R.gain129;
    res.gain131 = fitting.R.gain131;
    res.phase129 = fitting.Theta.phase129;
    res.phase131 = fitting.Theta.phase131;
    obj.SystemInfo.MagnetometerBandwidth = res;

    %%
    if p.Results.isPlot
        fig = obj.PlotMagnetometerBandwidth();
    end
    
    %%
    if p.Results.isReport
        getReporter;
        rpt.NewRecord(['MagnetometerBandwidth_' p.Results.description]);
        if p.Results.isPlot
            rpt.AppendFigure(fig, sprintf('MagnetometerBandwidth %s', p.Results.description));
        end
    end
    %%
    getSession;
    sess.addData('MagnetometerBandwidth', res, p.Results.description);
end


